﻿@model HdipCricketClub.ViewModels.ScorecardViewModel

@{
    ViewBag.Title = "Input Scorecard data";
}

<h2>Input Scorecard Data:</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>


<strong>@ViewBag.Team</strong>  vs  <strong>@ViewBag.OpponentClub @ViewBag.OpponentTeam</strong><br />
on <strong>@ViewBag.Date</strong><br/>
@ViewBag.BattedFirst

@using (@Html.BeginForm("InputData","Scorecard",FormMethod.Post))
{
@Html.ValidationSummary(true)    
<p>Innings of @Html.DisplayFor(model => Model.fixture.Team.Club.name) @Html.DisplayFor(model => Model.fixture.Team.name)   </p>
<p>Batting Figures:</p>
<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            Batting Position:
        </th>
        <th>
            How Out:
        </th>
        <th>
            Fielder:
        </th>
        <th>
            Bowler:
        </th>
        <th>
            Runs:
        </th>
    </tr>

@{var i = 1;}
@foreach (var item in Model.clubFixturePlayer)
{
<tr>    
        @Html.HiddenFor(ModelItem => item.fixture_id)
        @Html.HiddenFor(ModelItem => item.player_id)
    <td>
        @(i)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.Member.InitialAndLastName)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.batsman_number)
        @Html.ValidationMessageFor(ModelItem => item.batsman_number)
    </td>
    <td>
        @Html.DropDownList("dismissal_id", string.Empty)
        @Html.ValidationMessageFor(ModelItem => item.how_out)
    </td>
    <td>
        @Html.DropDownList("op_fielder_name", string.Empty)
    </td>   
    <td>
        @Html.DropDownList("op_bowler_name", String.Empty)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.batting_runs)
        @Html.ValidationMessageFor(ModelItem => item.batting_runs)
    </td>
</tr>
    i++;
}
</table>

<p>Bowling Figures:</p>

<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            Bowler No:
        </th>
        <th>
            Overs:
        </th>
        <th>
            Maidens:
        </th>
        <th>
            Wickets:
        </th>
        <th>
            Runs:
        </th>
     </tr>

@{i = 1;}
@foreach (var item in Model.opponentFixturePlayer)
{
<tr>    
    <td>
        @(i)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_player_name)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.op_bowler_number)
        @Html.ValidationMessageFor(ModelItem => item.op_bowler_number)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.op_overs)
        @Html.ValidationMessageFor(ModelItem => item.op_overs)
    </td>   
    <td>
        @Html.EditorFor(ModelItem => item.op_maidens)
        @Html.ValidationMessageFor(ModelItem => item.op_maidens)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.op_wickets)
        @Html.ValidationMessageFor(ModelItem => item.op_wickets)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.op_bowling_runs)
        @Html.ValidationMessageFor(ModelItem => item.op_bowling_runs)
    </td>
</tr>
    i++;
}
</table>

<p>Other fixture details</p>

    @Html.LabelFor(model => Model.clubOtherFixtureDetail.byes)     @Html.EditorFor(model => Model.clubOtherFixtureDetail.byes) @Html.ValidationMessageFor(model => Model.clubOtherFixtureDetail.byes)
    <br />
    @Html.LabelFor(model => Model.clubOtherFixtureDetail.leg_byes) @Html.EditorFor(model => Model.clubOtherFixtureDetail.leg_byes) @Html.ValidationMessageFor(model => Model.clubOtherFixtureDetail.leg_byes)
    <br />
    @Html.LabelFor(model => Model.clubOtherFixtureDetail.wides)    @Html.EditorFor(model => Model.clubOtherFixtureDetail.wides) @Html.ValidationMessageFor(model => Model.clubOtherFixtureDetail.wides)
    <br />
    @Html.LabelFor(model => Model.clubOtherFixtureDetail.no_balls) @Html.EditorFor(model => Model.clubOtherFixtureDetail.no_balls) @Html.ValidationMessageFor(model => Model.clubOtherFixtureDetail.no_balls)
    <br />
    <br /> 
<h3>Innings of @Html.DisplayFor(model => Model.fixture.Opponent.club_name) @Html.DisplayFor(model => Model.fixture.Opponent.team_name)</h3>
<p>Batting Figures:</p>
<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            Batting Position:
        </th>
        <th>
            How Out:
        </th>
        <th>
            Fielder:
        </th>
        <th>
            Bowler:
        </th>
        <th>
            Runs:
        </th>
    </tr>

@{i = 1;}
@foreach (var item in Model.opponentFixturePlayer)
{
<tr>    
        @Html.HiddenFor(ModelItem => item.op_fixture_id)
        @Html.HiddenFor(ModelItem => item.op_player_no)
    <td>
        @(i)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_player_name)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.op_batsman_number)
        @Html.ValidationMessageFor(ModelItem => item.op_batsman_number)
    </td>
    <td>
        @Html.DropDownList("op_dismissal_id", string.Empty)
        @Html.ValidationMessageFor(ModelItem => item.op_how_out)
    </td>
    <td>
        @Html.DropDownList("fielder_id", string.Empty)
    </td>   
    <td>
        @Html.DropDownList("bowler_id", string.Empty)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.op_batting_runs)
        @Html.ValidationMessageFor(ModelItem => item.op_batting_runs)
    </td>
</tr>
    i++;
}
</table>

<p>Bowling Figures:</p>

<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            Bowler No:
        </th>
        <th>
            Overs:
        </th>
        <th>
            Maidens:
        </th>
        <th>
            Wickets:
        </th>
        <th>
            Runs:
        </th>
     </tr>

@{i = 1;}
@foreach (var item in Model.clubFixturePlayer)
{
<tr>    
   <td>
        @(i)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.Member.first_name) @Html.DisplayFor(ModelItem => item.Member.last_name)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.bowler_number)
        @Html.ValidationMessageFor(ModelItem => item.bowler_number)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.overs)
        @Html.ValidationMessageFor(ModelItem => item.overs)
    </td>   
    <td>
        @Html.EditorFor(ModelItem => item.maidens)
        @Html.ValidationMessageFor(ModelItem => item.maidens)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.wickets)
        @Html.ValidationMessageFor(ModelItem => item.wickets)
    </td>
    <td>
        @Html.EditorFor(ModelItem => item.bowling_runs)
         @Html.ValidationMessageFor(ModelItem => item.bowling_runs)
    </td>
</tr>
    i++;
}
</table>

<p>Other fixture details</p>
    @Html.LabelFor(model => Model.opponentOtherFixtureDetail.byes) @Html.EditorFor(model => Model.opponentOtherFixtureDetail.byes) @Html.ValidationMessageFor(model => Model.opponentOtherFixtureDetail.byes)
    <br />
    @Html.LabelFor(model => Model.opponentOtherFixtureDetail.leg_byes) @Html.EditorFor(model => Model.opponentOtherFixtureDetail.leg_byes) @Html.ValidationMessageFor(model => Model.opponentOtherFixtureDetail.leg_byes)
    <br />
    @Html.LabelFor(model => Model.opponentOtherFixtureDetail.wides)    @Html.EditorFor(model => Model.opponentOtherFixtureDetail.wides) @Html.ValidationMessageFor(model => Model.opponentOtherFixtureDetail.wides)
    <br />
    @Html.LabelFor(model => Model.opponentOtherFixtureDetail.no_balls) @Html.EditorFor(model => Model.opponentOtherFixtureDetail.no_balls) @Html.ValidationMessageFor(model => Model.opponentOtherFixtureDetail.no_balls)
    <br />
    <br />
<p>
<input type="submit" value="Save" />
</p>    
} 



               